package interfaz;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

public class PanelBotones extends JPanel implements ActionListener{

	private JButton botonIngresar;
	
	private static final String INGRESAR = "Ingresar"; //Creo variable inmutable (private)
	
	private InterfazTMS interfazTMS;
	
	
	public PanelBotones(InterfazTMS nInterfaz)
	{
		interfazTMS = nInterfaz; //Asi puedo adquirir la interfaz que yo quiero
		botonIngresar = new JButton("Ingresar Paciente");
		
		setLayout(new GridLayout(1, 1));
		add(botonIngresar);
		botonIngresar.addActionListener(this);
		botonIngresar.setActionCommand(INGRESAR);
		
	}
	
	public void inhabilitarBoton(){
		botonIngresar.setEnabled(false);
	}
	

	@Override
	public void actionPerformed(ActionEvent event) 
	{
		if (event.getActionCommand().equals(INGRESAR)){
			interfazTMS.ingresarPaciente();
		}
	}

	public void reiniciar()
	{
		botonIngresar.setEnabled(true);
	}

}
